import React, {FC} from 'react'
import { Radio, Typography, List, RadioChangeEvent } from 'antd'
import prices from '../../helpers/price'

interface Props {
    handleChange: (value: number[]) => void
}

const RedioBox: FC<Props> = ({ handleChange }) => {
    function onChange(e: RadioChangeEvent) {
        handleChange(e.target.value as number[])
    }
    return (
        <>
            <Typography.Title level={4}>按照价格进行筛选</Typography.Title>
            <Radio.Group onChange={onChange}>
                <List dataSource={prices} renderItem={(item, index) => (
                    <List.Item key={index}>
                        <Radio key={index} value={item.array}>{item.name}</Radio>
                    </List.Item>
                )} />
            </Radio.Group>
        </>
    )
}

export default RedioBox
